#!/bin/bash

proxy_host=127.0.0.1
proxy_port=58591

if [ $# -eq 0 ]; then
   pswitch="on"
fi

if [ $# -gt 0 ]; then
    pswitch=$1    
fi 

if [ $# -gt 1 ]; then
    proxy_host=$2    
fi 

if [ $# -gt 2 ]; then
    proxy_port=$3
fi 

cur_dir=$(cd `dirname $0`;pwd)
$cur_dir/gitproxy.sh $pswitch $proxy_host $proxy_port

if [ $pswitch = "on" ]; then   
    echo "set shell proxy"
    export http_proxy=http://$proxy_host:$proxy_port
    export https_proxy=http://$proxy_host:$proxy_port
else    
    echo "unset shell proxy"
    unset http_proxy
    unset https_proxy
fi

echo "http_proxy:" $http_proxy
echo "https_proxy:" $https_proxy
